<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	
		<title><?php echo C('WEB_TITLE');?></title>
	
	<link rel="stylesheet" type="text/css" href="../Public/css/base.css" media="all">
	<link rel="stylesheet" type="text/css" href="../Public/css/module.css">
	<link rel="stylesheet" type="text/css" href="../Public/css/style.css" media="all">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/artDialog/skins/default.css">
	<script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Js/artDialog/jquery.artDialog.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Js/artDialog/artDialog.plugins.min.js"></script>
	<script type="text/javascript" src="../Public/js/common.js"></script>
	<?php if(in_array((ACTION_NAME), explode(',',"add,edit"))): ?><script type="text/javascript" src="__PUBLIC__/Js/ValidForm.js"></script><?php endif; ?>
	
	<script type="text/javascript">
        var URL	   ='__URL__';
        var PUBLIC = "../Public/";
    </script>
</head>
<body style="padding:0;">
	
	<div id="main-content">
		<div id="top-alert" class="fixed alert alert-error" style="display: none;">
			<button class="close fixed" style="margin-top: 4px;">&times;</button>
			<div class="alert-content">这是内容</div>
		</div>
		<div id="main" class="main">
			
	<div class="main-title">
		<h2><?php if((ACTION_NAME) == "add"): ?>新增<?php else: ?>编辑<?php endif; ?>配置 [ <A HREF="__URL__">返回列表</A> ]</h2>
	</div>
	<FORM METHOD="POST" id="form1" class="form-horizontal" action="__URL__/<?php if((ACTION_NAME) == "add"): ?>insert<?php else: ?>update<?php endif; ?>">
			<div class="form-item cf">
				<label class="item-label">变 量：<span class="check-tips"></span></label>
				<div class="controls"><INPUT TYPE="text" class="text input-large" NAME="name" value="<?php echo ($vo["name"]); ?>"  dataType="*1-25" nullmsg="配置名不能为空,且不能含有空格" errormsg="配置名不能为空,且不能含有空格">
					</div>
				</div>
			<div class="form-item cf">
				<label class="item-label">名 称：<span class="check-tips"></span></label>
				<div class="controls">
					<INPUT TYPE="text" class="text input-large"  NAME="title" value="<?php echo ($vo["title"]); ?>">
				</div>
			</div>
			<div class="form-item cf">
				<label class="item-label">配 置：<span class="check-tips"></span></label>
				<div class="controls">
				<TEXTAREA style="overflow:auto" class="text input-large " NAME="value" ROWS="5" COLS="35"><?php echo ($vo["value"]); ?></TEXTAREA>
				</div>
			</div>
			<div class="form-item cf">
				<label class="item-label">类 型：<span class="check-tips"></span></label>
				<div class="controls">
					<SELECT class="medium bLeft" NAME="type">
						<option <?php if(($vo["type"]) == "0"): ?>selected<?php endif; ?> value="0">字符型</option>
						<option <?php if(($vo["type"]) == "1"): ?>selected<?php endif; ?> value="1">数字型</option>
						<option <?php if(($vo["type"]) == "2"): ?>selected<?php endif; ?> value="2">布尔型</option>
						<option <?php if(($vo["type"]) == "3"): ?>selected<?php endif; ?> value="3">文本型</option>
						<option <?php if(($vo["type"]) == "4"): ?>selected<?php endif; ?> value="4">枚举型</option>
					</SELECT>
				</div>
			</div>
			<div class="form-item cf">
				<label class="item-label">
					参 数：
					<span class="check-tips">
						布尔型、枚举型请输入参数（用,分割多个参数 用:分割值和显示）,布尔型采用两个参数，前面的表示否
					</span>
				</label>
				<div class="controls">
					<TEXTAREA class="text input-large" NAME="extra" ROWS="5" COLS="35"><?php echo ($vo["extra"]); ?></TEXTAREA>
				</div>
			</div>
			<div class="form-item cf">
				<label class="item-label">备  注：<span class="check-tips"></span></label>
				<div class="controls">
					<TEXTAREA class="text input-large" NAME="remark" ROWS="5" COLS="35"><?php echo ($vo["remark"]); ?></TEXTAREA>
				</div>
			</div>
		<div class="form-item">
			<INPUT TYPE="hidden" name="id" value="<?php echo ($vo["id"]); ?>">
			<INPUT TYPE="hidden" name="jumpurl" value="<?php echo ($_SERVER['HTTP_REFERER']); ?>">
			<button type="submit" class="btn submit-btn ajax-post">确 定</button>
			<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
		</div>
	</FORM>
	<script type="text/javascript">
	$(function(){
		$('#form1').Validform({
			tiptype:function(msg,o,cssctl){
                if(!o.obj.is("form")){
                	var pele=o.obj.parents('.form-item');
                    var infoObj=pele.find(".check-tips");
                    if (!infoObj || infoObj.length==0){
                        pele.find(".item-label").append('<span class="check-tips"></span>');
                    }
                    infoObj=pele.find(".check-tips");
                    if(o.type==2){
                        infoObj.removeClass('error');
                        infoObj.hide();
                    }else{
                        infoObj.addClass('error');
                        infoObj.html(msg).show();
                    }
                }
            }
		});
	})
	</script>

		</div>
		<!-- <div class="cont-ft">
			<div class="copyright">
				<div class="fl">感谢使用<a href="http://www.onethink.cn" target="_blank">OneThink</a>管理平台</div>
				<div class="fr">V1.0.131129</div>
			</div>
		</div> -->
	</div>
	<script type="text/javascript">
        +function(){
            var $window = $(window), $subnav = $("#subnav"), url;
            $window.resize(function(){
                $("#main").css("min-height", $window.height() - 130);
            }).resize();
            $("#subnav h3 a").click(function(e){e.stopPropagation()});
	        /* 表单获取焦点变色 */
	        $("form").on("focus", "input", function(){
		        $(this).addClass('focus');
	        }).on("blur","input",function(){
				        $(this).removeClass('focus');
			        });
		    $("form").on("focus", "textarea", function(){
			    $(this).closest('label').addClass('focus');
		    }).on("blur","textarea",function(){
			    $(this).closest('label').removeClass('focus');
		    });
            // 导航栏超出窗口高度后的模拟滚动条
            var sHeight = $(".sidebar").height();
            var subHeight  = $(".subnav").height();
            var diff = subHeight - sHeight; //250
            var sub = $(".subnav");
            if(diff > 0){
                $(window).mousewheel(function(event, delta){
                    if(delta>0){
                        if(parseInt(sub.css('marginTop'))>-10){
                            sub.css('marginTop','0px');
                        }else{
                            sub.css('marginTop','+='+10);
                        }
                    }else{
                        if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                            sub.css('marginTop','-'+(diff-10));
                        }else{
                            sub.css('marginTop','-='+10);
                        }
                    }
                });
            }
        }();
		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
	        var query  = $('.search-form').find('input').serialize();
	        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
	        query = query.replace(/^&/g,'');
	        if( url.indexOf('?')>0 ){
	            url += '&' + query;
	        }else{
	            url += '?' + query;
	        }
			window.location.href = url;
		});
		//回车搜索
		$(".search-input").keyup(function(e){
			if(e.keyCode === 13){
				$("#search").click();
				return false;
			}
		});
		$(function(){
			$('.row td:gt(0)').attr('nowrap','');
			$('.row th:gt(0)').attr('nowrap','');
			$('.row:gt(0)').click(function(e){
				if(e.target.name!='key'){
					// && !e.target.href
					var xx=$(this).find(':checkbox');
					xx.attr('checked',!xx.attr('checked'));
				}
			});
			$('.Abstruct').each(function(){
				if ($(this).attr('type')=='img'){
					var src=$(this).html();
					$(this).click(function(){
						$.dialog({ 
							title:'查看图片',
							content: src+'<br><img src="'+src+'" />'
						}); 
					});
				}else{
					var src=$(this).html();
					$(this).click(function(){
						$.dialog({ 
							title:'查看详细',
							content: eval(src)
						}); 
					});
				}
				$(this).attr('title',$(this).html());
			});

		})
	</script>
	
</body>
</html>